#include <bits/stdc++.h>
int n;
char aa[101][101], danci[8] = {"yizhong"};
int bb[101][101] = {0}, dir[][2] = {{-1, -1}, {-1, 0}, {-1, 1}, {0, -1}, {0, 1}, {1, -1}, {1, 0}, {1, 1}};
struct node
{
    int x, y;
} c[7];
void dfs(int x, int y, int cur, int k)
{
    if (cur == 7)
    {
        for (int i = 0; i < 7; i++)
            bb[c[i].x][c[i].y] = 1;
    }
    else
    {
        int dx = x + dir[k][0], dy = y + dir[k][1];
        if (cur == 6 || aa[dx][dy] == danci[cur + 1])
        {
            c[cur].x = x;
            c[cur].y = y;
            dfs(dx, dy, cur + 1, k);
        }
    }
}
int main()
{
    scanf("%d", &n);
    for (int i = 0; i < n; i++)
    {
        scanf("%s", aa[i]);
    }
    for (int i = 0; i < n; i++)
    {
        for (int j = 0; j < n; j++)
        {
            if (aa[i][j] == danci[0])
            {
                for (int k = 0; k < 8; k++)
                {
                    int dx = i + dir[k][0], dy = j + dir[k][1];
                    if (aa[dx][dy] == danci[1])
                        dfs(i, j, 0, k);
                }
            }
        }
    }
    for (int i = 0; i < n; i++)
    {
        for (int j = 0; j < n; j++)
        {
            if (bb[i][j])
                printf("%c", aa[i][j]);
            else
                printf("*");
        }
        printf("\n");
    }
    return 0;
}